package com.chinaunicom.behavior.observer;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2022/8/19 10:40
 * Description:
 */
public class Client {

    public static void main(String[] args) {

        Publisher publisher = new Publisher();
        ConcreteSubscriberOne concreteSubscriberOne = new ConcreteSubscriberOne();
        publisher.subscribe("open", concreteSubscriberOne);

        ConcreteSubscriberTwo concreteSubscriberTwo = new ConcreteSubscriberTwo();
        publisher.subscribe("save", concreteSubscriberTwo);
        
        publisher.notify("open", "test message push ......");

        publisher.notify("save", "test message push ......");


        System.out.println("--------------------------------------------------------");
        publisher.unSubscribe("sae", concreteSubscriberTwo);
        publisher.notify("open", "test message push ......");

        publisher.notify("save", "test message push ......");
        
    }
}
